﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Store
{
    [Serializable]
    abstract partial class Goods
    {
        // Исключения закомментированы. Песле реализации Класса Исключений доделать.

        int quantity;
        double inputPrice;
        double outputPrice;
        string name;
        string description;

        public int Quantity
        {
            get
            {
                return this.quantity;
            }
            set
            {
                //if (value <= 0)
                //{
                //    throw MyException();
                //}
                //else
                this.quantity = value;
            }
        }
        public double InputPrice
        {
            get
            {
                return this.inputPrice;
            }
            set
            {
                //if (value <= 0)
                //{
                //    throw MyException();
                //}
                //else
                this.inputPrice = value;
            }
        }
        public double OutputPrice
        {
            get
            {
                return this.outputPrice;
            }
            set
            {
                //if (value <= 0)
                //{
                //    throw MyException();
                //}
                //else
                this.outputPrice = value;
            }
        }
        public string Name
        {
            get
            {
                return this.name;
            }
            set
            {
                //if (value.Length <= 0 || value.Length >= 15)
                //{
                //    throw MyException();
                //}
                //else
                this.name = value;
            }
        }
        public string Description
        {
            get
            {
                return this.description;
            }
            set
            {
                //if (value.Length <= 0 && value.Length >= 30)
                //{
                //    throw MyException();
                //}
                //else
                this.description = value;
            }
        }

        /// <param name="name">Название</param>
        /// <param name="amount">Количество</param>
        /// <param name="iPrice">Цена закупки</param>
        /// <param name="oPrice">Цена продажи</param>
        /// <param name="description">Описание товара</param>
        public Goods(string name, int amount , double iPrice, double oPrice, string description)
        {
            this.Name = name;
            this.InputPrice = iPrice;
            this.OutputPrice = oPrice;
            this.Quantity = amount;
            this.Description = description;
        }

        public override string ToString()
        {
            return String.Format("{0} {1} шт.",this.Name,this.quantity);
        }
    }
}
